﻿using MugenInjection.Attributes;
using MugenInjection.Core;
using MugenInjection.Xml.Components;
using MugenInjection.Xml.Interface.Components;

namespace MugenInjection.Xml.Modules
{
    /// <summary>
    /// Represents module that adds support for load bindings from xml.
    /// </summary>
#if !NOLOADASSEMBLY
    [AutoLoadModuleRequired]
#endif
    public sealed class XmlLoaderModule : InjectorModule
    {
        #region Overrides of InjectorModule

        /// <summary>
        /// Loads bindings and components in current module. 
        /// </summary>
        public override void Load()
        {
            IXmlBindingLoaderComponent component;
            if (Injector.Components.TryGet(out component) && component is XmlBindingLoaderComponent)
                return;
            AddComponent(new XmlBindingLoaderComponent());
        }

        #endregion
    }
}